{% extends 'base/base_table.html' %}

{% block title %}ITAdmin | 监控主机{% endblock %}

{% load tags %}

{% block table_thead %}
<tr>
    <th style="text-align: center;vertical-align: middle">zabbix主机ID</th>
    <th style="text-align: center;vertical-align: middle">主机名</th>
    <th style="text-align: center;vertical-align: middle">zabbix监控IP</th>
    <th style="text-align: center;vertical-align: middle">连接</th>
</tr>
{% endblock %}

{% block table_bady %}
{% for object in objects %}
    <tr>
        <td style="text-align: center;vertical-align: middle">{{ object.hostid }}</td>
        <td style="text-align: center;vertical-align: middle">{{ object.host }}</td>
        <td style="text-align: center;vertical-align: middle">{{ object.interfaces.0.ip }}</td>
        <td style="text-align: center;vertical-align: middle">
             <a class="btn btn-info " type="button" href="{% get_zabbix_item_url object.hostid object.host %}">
                 <i class="fa fa-search"></i> 查看
             </a>
        </td>
    </tr>
{% endfor %}
{% endblock %}

{% block script %}
<script type="text/javascript">
    $(function () {

        $('#pages').val('{{ entry }}')
        $('#pages').change(function () {
            var search = '{{ search }}'
            if (search == '') {
                location.href = "{% url 'zabbix' %}?page={{ num }}&entry=" + $(this).val();
            } else {
                location.href = "{% url 'zabbix' %}?page={{ num }}&{{ search }}&entry=" + $(this).val();
            }
        });
    });
</script>
{% endblock %}
